package com.one.material.controller;

import com.alibaba.fastjson.JSON;
import com.one.material.entity.Material;
import com.one.material.feign.FeignMaterial;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author windows
 */
@RestController
@RequestMapping("ma")
public class MaterialController {

    @Resource
    private FeignMaterial feignMaterial;



    @RequestMapping("all")
    public List<Material> getAll() {
        String materialAll = feignMaterial.getMaterialAll();
        System.err.println(materialAll);
        List<Material> materials = JSON.parseArray(materialAll, Material.class);
        materials.forEach(res -> {
            System.err.println(res.getId());
        });
        return materials;
    }
}
